<?php

// Work-around for setting up a session because Flash Player doesn't send the cookies
if (isset($_POST["PHPSESSID"])) {
	session_id($_POST["PHPSESSID"]);
}
session_start();


// We accept files only smaller than 10 MBytes
// Total size we compute before sending them
if((is_dir('./internal') || mkdir('./internal')))
{
    if(is_dir('./internal/' . session_id()) || mkdir('./internal/' . session_id()))
    {
        if(filesize($_FILES['Filedata']['tmp_name']) <= 1024000000)
        {
            move_uploaded_file($_FILES['Filedata']['tmp_name'],
                './internal/' . session_id() . '/' . $_FILES['Filedata']['name'] . '.noexecute'
            );
        }
    }
}

